package service.impl;

import dao.StuDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Student;
import service.StuService;

import java.util.List;

@Service("StuService")
public class StuServiceimpl implements StuService {
    @Autowired
    private StuDao stuDao;
    @Override
    public List<Student> findAll(Student student,int offset,int pageSize){
        List<Student> students =stuDao.findAll(student.getStudentNum(),student.getStudentName(),offset,pageSize);
        return students;
    }

    @Override
    public int count(Student student) {
        return stuDao.count(student);
    }

    @Override
    public int addStu(Student student) {
        return stuDao.addStudent(student);
    }

    @Override
    public int deleteStuById(int sId) {
        return stuDao.deleteStudentById(sId);
    }

    @Override
    public int updateStu(Student student) {
        return stuDao.updateStudent(student);
    }

    @Override
    public Student findById(int sId) {
        return stuDao.findById(sId);
    }

    @Override
    public boolean login(Student student) {
        if(stuDao.login(student)>0){
            return true;
        }
        return false;
    }
}
